<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('树形方案列表')"/>
</head>
<body>
<div class="d-flex flex-column">
    <div>
        <form id="formId">
            <div class="select-list">
                <ul>
                    <li class="select-time">
                        <p>创建时间：</p>
                        <input type="text" class="time-input" id="beginCreatedTime" placeholder="开始时间"
                               name="beginCreatedTime"/>
                        <span>-</span>
                        <input type="text" class="time-input" id="endCreatedTime" placeholder="结束时间"
                               name="endCreatedTime"/>
                    </li>
                    <li>
                        <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                            class="fa fa-search"></i>&nbsp;搜索</a>
                        <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                            class="fa fa-refresh"></i>&nbsp;重置</a>
                    </li>
                </ul>
            </div>
        </form>
    </div>
    <div class="flex-grow-1">
        <div class="select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>

</body>
<th:block th:include="include :: footer"/>
<script>
    var prefix = ctx + "${tableName}";
    $(function () {
        //table初始化
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            detailUrl: prefix + "/view/{id}",
            modalName: "${tableComment!}",

            showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            clickToSelect:true,
            singleSelect:true,
            onCheck:doSelect,
            columns: [{
                field: 'state',
                checkbox: true
            },
<#list  columns as field>
        <#if field.isPk=="1">
        {
            field: '${field.columnName!}',
            title: 'ID',
            visible: false
        },
            <#else>
        {
            field: '${field.columnName!}',
            title: '${field.columnComment!}'
        },
    </#if>
</#list>
               ]
        };
        $.table.init(options);

    });

    var resp={}
    function doSelect(obj){
        console.log(obj)
        resp=obj
    }

    function callback(){
        return resp;
    }
</script>
</html>